@Override
  public Contact update(Integer id, Contact contact) throws ContactServiceException {

    Contact contactBD = contactRepository.findOne(id);

    if (contactBD == null) {
      throw new ContactServiceException();
    }

    contactBD.setName(contact.getName());
    contactBD.setEmail(contact.getEmail());
    return contactRepository.saveAndFlush(contactBD);
  }
  @Override
  public Contact create(Contact contact) throws ContactServiceException {

    Contact contactBD = contactRepository.findOneByEmail(contact.getEmail());

    if (contactBD == null) {
      return contactRepository.saveAndFlush(contact);
    }

    throw new ContactServiceException();
  }