public EmployeeCompany Create(CreateEmployeeCompanyCommand command)
        {
            var employee = new EmployeeCompany(command.Cpf, command.IdSectorCompany, command.IdCompany, command.User);

            employee.Create();
            _repository.Create(employee);

            if (Commit())
            {
                return(employee);
            }

            return(null);
        }
        public Task <HttpResponseMessage> Post([FromBody] dynamic body)
        {
            var user = new User((string)body.user.email,
                                (string)body.user.name,
                                (string)body.user.lastName,
                                (string)body.user.password,
                                (string)body.user.nickName,
                                body.user.listAddressUser.ToObject <List <AddressUser> >(),
                                body.user.listPhoneUser.ToObject <List <PhoneUser> >());


            var command = new CreateEmployeeCompanyCommand(
                cpf: (string)body.cpf,
                user: user,
                idSectorCompany: (int)body.idSectorCompany,
                idCompany: (int)body.idCompany
                );

            var employee = _service.Create(command);

            return(CreateResponse(HttpStatusCode.Created, employee));
        }