public FemaleParrentsMale Convert(Females female)
        {
            var parrents = new ParrentsRepository().GetParrents(female.Id);

            var currentRabbit = new FemaleParrentsMale
            {
                Id = female.Id,
                FemaleName = female.Name,
                DateOfBirth = female.DateOfBirth,
                CageId = female.CageId,
                FatherId1 = parrents.FatherId1,
                FatherId2 = parrents.FatherId2,
                MotherId = parrents.MotherId,
                MotherName = new FemalesRepository().GetFemale(parrents.MotherId).Name
            };

            if (female.CageId != null)
                currentRabbit.CageName = new CagesRepository().GetCage((int)female.CageId).Name;
            if (parrents.FatherId1 != null)
                currentRabbit.FatherName1 = new MalesRepository().GetMale((int) parrents.FatherId1).Name;
            if (parrents.FatherId2 != null)
                currentRabbit.FatherName2 = new MalesRepository().GetMale((int) parrents.FatherId2).Name;

            return currentRabbit;
        }
        public void AddFemale(Females female)
        {
            using (var context = new RabbitsDBEntities())
            {
                if (IsNameExist(female.Name, context))
                    throw new InvalidOperationException(AlreadyExist);

                context.Females.Add(female);
                context.SaveChanges();
            }
        }
        public void UpdateFemale(Females female)
        {
            using (var context = new RabbitsDBEntities())
            {
                var result = context.Females.FirstOrDefault(x => x.Id == female.Id);
                if (result == null)
                    throw new InvalidOperationException(DoesNotExist);

                if (result.Name != female.Name && IsNameExist(female.Name, context))
                    throw new InvalidOperationException(AlreadyExist);

                result.Name = female.Name;
                result.DateOfBirth = female.DateOfBirth;
                result.CageId = female.CageId;

                context.SaveChanges();
            }

        }