public static Result <Phone> Create(GroupPhone groupPhone, string number)
        {
            var errors = new List <string>();

            if (groupPhone is null)
            {
                errors.Add(nameof(groupPhone));
            }
            if (string.IsNullOrEmpty(number))
            {
                errors.Add("Number is required");
            }

            if (errors.Any())
            {
                return(Result <Phone> .Fail(errors));
            }

            var newPhone = new Phone
            {
                GroupPhone = groupPhone,
                Number     = number
            };

            return(Result <Phone> .Success(newPhone));
        }
        public Result <bool> UpdatePhone(int id, GroupPhone groupPhone, string number)
        {
            var phone = PhoneInternal.FirstOrDefault(g => g.Id == id);

            if (phone != null)
            {
                var updateResult = phone.Update(groupPhone, number);
                if (!updateResult.Succeeded)
                {
                    return(Result <bool> .Fail(updateResult.Errors));
                }
                return(Result <bool> .Success(true));
            }
            return(Result <bool> .Fail("Phone not found"));
        }
        public Result <bool> RemoveGroupPhone(GroupPhone groupPhoneToDelete)
        {
            var errors = new List <string>();

            if (groupPhoneToDelete is null)
            {
                errors.Add(nameof(groupPhoneToDelete));
            }

            if (errors.Any())
            {
                return(Result <bool> .Fail(errors));
            }

            GroupPhoneInternal.Remove(groupPhoneToDelete);
            return(Result <bool> .Success(true));
        }
        public static Result <GroupPhone> Create(string name)
        {
            var errors = new List <string>();

            if (string.IsNullOrEmpty(name))
            {
                errors.Add(" Name is required");
            }

            if (errors.Any())
            {
                return(Result <GroupPhone> .Fail(errors));
            }

            var newGroupPhone = new GroupPhone
            {
                Name = name
            };

            return(Result <GroupPhone> .Success(newGroupPhone));
        }
        public Result <bool> Update(GroupPhone groupPhone, string number)
        {
            var errors = new List <string>();

            if (groupPhone is null)
            {
                errors.Add(nameof(groupPhone));
            }
            if (string.IsNullOrEmpty(number))
            {
                errors.Add("Number is required");
            }

            if (errors.Any())
            {
                return(Result <bool> .Fail(errors));
            }

            GroupPhone = groupPhone;
            Number     = number;

            return(Result <bool> .Success(true));
        }
        public Result <bool> AddGroupPhone(GroupPhone groupPhone)
        {
            GroupPhoneInternal.Add(groupPhone);

            return(Result <bool> .Success(true));
        }